package com.tn.exam.util.taoyf.enchar;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.tn.exam.constant.ExamConstant;

public class DataUtil {
	public static boolean isValid(List list){
		if(list == null || list.size() == 0){
			return false;
		}else{
			return true;
		}
		
	}
	
	public static boolean isValid(String str){
		if(str == null || str.length() == 0){
			return false;
		}else{
			return true;
		}
		
	}
	
	public static Timestamp getTimestamp() {
		Date date = new Date();
		SimpleDateFormat simple = new SimpleDateFormat(
				ExamConstant.DATA_FORMAT);
		return Timestamp.valueOf(simple.format(date));
	}
	
	public static String dateTime4String(Date date){
		if(date == null){
			date = new Date();
		}
		SimpleDateFormat simple = new SimpleDateFormat(
				ExamConstant.DATA_FORMAT);
		return simple.format(date);
	}
	
	public static void main(String[] args) {
		System.out.println(dateTime4String(new Date()));
	}
}	
